﻿namespace Socket.Core
{
    using System;
    using System.Runtime.CompilerServices;

    public class UserToken
    {
        public UserToken()
        {
            this.SessionId = Guid.NewGuid().ToString();
            DateTime now = DateTime.Now;
            this.ConnectTime = now;
            this.LastActiveTime = now;
        }

        public void Login(string userTokenId)
        {
            this.UserTokenId = userTokenId;
        }

        public void UpdateLastActiveTime()
        {
            this.LastActiveTime = DateTime.Now;
        }

        public DateTime ConnectTime { get; private set; }

        public DateTime LastActiveTime { get; private set; }

        public string SessionId { get; private set; }

        public string UserTokenId { get; private set; }
    }
}

